package com.sv.web.list.impl;

import java.util.Map;

import org.springframework.ui.Model;

import com.sv.model.PageInfo.LikeModel;
import com.sv.web.ListSqlIdParam;
import com.sv.web.list.ListPageInitializaion;

public class ContentPageList extends ListPageInitializaion {

    public ContentPageList(ListSqlIdParam listSqlId) {
        super(listSqlId);
    }

    @SuppressWarnings("rawtypes")
    @Override
    public void initClause(Model model) {

        Map map = model.asMap();

        page.creatCriteria()
                .addBetweenCriterion("a.content_id",
                        (Integer) map.get("startId"),
                        (Integer) map.get("endId"))
                .addLikeCriterion("b.title", (String) map.get("title"),
                        LikeModel.SUF)
                .addCriterion("a.content_id = b.content_id");
        
//        page.creatCriteria().addCriterion("a.content_id = b.content_id").addCriterion("a.channel_id = ", 2);

        page.setOrderByClause("a.content_id desc");
    }

}
